home *** CD-ROM | disk | FTP | other *** search
- /*
- ** File: WebStat.h
- **
- ** Author: P. Harvey
- **
- ** Comments: Class definitions for WebStat program
- */
-
- #include <stdio.h>
- #include <time.h>
-
- class Statistic {
- public:
- Statistic();
- ~Statistic();
-
- void IncrStats(double byte_count);
-
- unsigned long files;
- double bytes;
- char * name;
- };
-
- extern "C" typedef int (*CompFunc)(const void *, const void *);
-
- class StatList {
- public:
- StatList(long iSize);
- ~StatList();
-
- void Write(FILE *fp, char *heading);
- void IncrStats(double byte_count, char *str);
- long SearchStat(char *str);
- void Substitute(char *(*func)(const char *));
- void Sort(CompFunc func=0);
- static void Summarize(FILE *fp, time_t first, time_t last);
- static void IncrTotals(double byte_count);
-
- private:
- Statistic *stat; // pointer to statistics table
- long num; // number of entries in table
- long maxNum; // number of entries allocated
- long incrSize; // number of entries to expand by
-
- static unsigned long totalFiles;
- static double totalBytes;
- };
-
- class StringLookup {
- public:
- StringLookup(long incr,Boolean part);
- ~StringLookup();
-
- void Add(char *code, char *name);
- char * Lookup(char *code);
-
- private:
- long num;
- long maxNum;
- long incrNum;
- char **list; // Format is "<code>\0<name>\0"
- Boolean partialCompare;
- };
-
- extern "C" int CompStat(const void *p1, const void *p2);
- extern "C" int CompStatNum(const void *p1, const void *p2);
-